#ifdef ENABLE_MAPLE_SAN

#ifndef ASAN_ASAP_H
#define ASAN_ASAP_H

#include <vector>
#include <map>
#include <set>
#include "san_common.h"
#include "asan_razor.h"

namespace maple {

class ASAPStmtKey {
public:
  StmtID stmtid;
  std::string src_path;
  ASAPStmtKey(StmtID stmtid, std::string src_path) : stmtid(stmtid), src_path(src_path){};
  bool operator<(const ASAPStmtKey &rhs) const {
    if (this->stmtid == rhs.stmtid) {
      return this->src_path < rhs.src_path;
    }
    return this->stmtid < rhs.stmtid;
  }
};

enum ASAPMode{
  NUM,
  COST
};

typedef std::pair<ASAPStmtKey, AsanRazorCheckCount> ASAPStmtKeyCountPair;
extern std::vector<ASAPStmtKeyCountPair> OrderedStmtKeyCountPairs;
extern std::set<ASAPStmtKey> ASAPAsanRelevantStmtKey;

extern double ASAPThreshold;
extern std::set<ASAPStmtKey> ASAPToRemoveAsanIDs;
extern std::map<const ASAPStmtKey, AsanBlockCost> ASAPStmtKey2CostMap;

// for each module, do it only once
void InitializeOrderedStmtKeyCountPairs();
void LoadASAPThreshold(ASAPMode mode);
void DecideToBeRemoved(ASAPMode mode);
void SetThisFileASAPToRemoveStmtIDs(std::string filename);

// call for each function
void ASAPRemoveAsanChecks(std::string filename, BlockNode* block);

} // namespace maple

#endif // ASAN_ASAP_H

#endif // ENABLE_MAPLE_SAN
